package respons

import "github.com/gin-gonic/gin"

type Res struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

func Success(c *gin.Context, data interface{}) {
	c.JSON(200, Res{
		Code: 200,
		Msg:  "success",
		Data: data,
	})
	return
}

func Error(c *gin.Context, code int, msg string) {
	c.JSON(500, Res{
		Code: code,
		Msg:  msg,
		Data: nil,
	})
	return
}
